package com.mc.mcgoweb.utils.encrypt.aesencrypt;

import com.mc.mcgoweb.vo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestController {
 
    /*
     * 测试返回数据，会自动加密
     * @return
     */
    @GetMapping("/get")
    @ResponseBody
    @SecurityParameter
    public Object get() {
        Student info = new Student();
        info.setName("好看");
        return info;
    }
    /*
     * 自动解密，并将返回信息加密
     * @param info
     * @return
     */
    @RequestMapping("/save")
    @ResponseBody
    @SecurityParameter
    public Object save(@RequestBody Student info) {
        //注意 用postman测试的时候先把要传递的数据通过AesEncryptUtils中的main函数生成加密的数据
        //然后在postman中 JSON中传递{"requestData":"NukZfqXOqsIJe5K/5svC71Cy+1T6uSl6HWsKM+1esNM="}即可
        System.out.println(info.getName());
        return info;
    }

}
